Regular Expressions

 

Regular expressions are basically a grammar that can be used to perform complicated pattern matching operations. You should already know how to use Regular expressions before using the identifiers below.

 

It is beyond the scope of this help file to explain how Regular Expressions work. There are many websites on the internet that introduce regular expressions and provide examples.

 

$regex([name], text, re)

Returns N, the number of strings in text that matched the regular expression.

 

You can assign a name to a $regex() call which you can use later in $regml() to reference a match list.

 

If you don't specify a name, all identifiers use a default name which is overwritten with each call to $regex().

 

$regex() remembers the results for the last fifty $regex() calls. Each time you do a match with $regex(), and you specify a name, that name's previous results are overwritten with the new results.

 

$regml([name], N)

This can be used to reference the back referenced (items enclosed in parentheses) values returned by a call to $regex() or $regsub().

 

Properties: pos

 

If N = 0, returns total number of match strings.

 

The pos property returns a strings position in the original match text.

 

$regsub([name], text, re, subtext, %var)

Performs a regular expression match, like $regex(), and then performs a substitution using subtext.

 

Returns N, the number of substitutions made, and assigns the result to %var.

 

$regsubex([name], text, re, subtext)

Performs a regular expression match, like $regex(), and then performs a substitution using subtext.

 

Subtext is evaluated during substitution and can be an identifier.

 

Subtext can also contain special markers where \0 = number of matches, \n = match number, \t = match text, \a = all match items, and \A which is a non-spaced version of \a.

 

Returns text result.